package com.vhall.component.plugin.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author shimingming
 * @since 2023/5/16 15:52
 */
@Getter
@AllArgsConstructor
public enum LoginTypeEnum {


    DEFAULT(0, "默认值"),

    HOST_LOGIN(1, "主持人端登录"),

    GUEST_ASSISTANT(3, "嘉宾助理 口令登录"),

    WHITE_LIST(5, "白名单"),
    AUDIENCE(6, "正常观众"),
    REGISTERED_AUDIENCE(7, "报名观众"),


    ;
    private final Integer value;

    private final String description;

    public static String getDescription(Integer value) {
        LoginTypeEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescription();
        }
        return StringUtils.EMPTY;
    }

    public static LoginTypeEnum parse(Integer value) {
        for (LoginTypeEnum anEnum : LoginTypeEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return DEFAULT;
    }
}
